package com.dengtacj.puppeteerspider.tasks;

import com.dengtacj.puppeteerspider.actions.StockShNoticeAction;
import com.dengtacj.puppeteerspider.actions.StockSzNoticeAction;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

@Configuration
@Lazy(value = false)
@EnableScheduling
public class NoticeTask {

    @Autowired
    private JdbcTemplate jdbcTemplate;

    /**
     * @description 深交所问询函件的爬虫 测试优化用
     */
//    @Scheduled(fixedRate = 5*1000)
//    public void szInquiryTask(){
//        new SpiderAction().init(1);
//    }

    /**
     * @description 上交所的临时停牌爬虫实现
     */
    @Scheduled(fixedRate = 30*60*1000)
    public void stockShaTask(){
        new StockShNoticeAction(jdbcTemplate).init();
    }

    /**
     * @description 深交所的临时停牌的爬虫实现
     */
    @Scheduled(fixedRate = 30*60*1000)
    public void stockSzTask(){
        new StockSzNoticeAction(jdbcTemplate).init();
    }

    /**
     * @description 清除问询函中间表的历史数据 保留最近30天数据
     */
//    @Scheduled(fixedRate = 60*1000)
//    public void  cleanTask(){
//        new ClearOldDataAction().del_30days_ago();
//    }
}
